import './header.html';


import './header_user_logged.js';
import './header_user_not_logged.js';



Template.App_Header.helpers({
  user() {
    let userid = Meteor.userId();
    if ( userid != undefined ) {

     return '<a class="btn btn-primary navbar-btn navbar-right" role="button" href="/login">退出</a><a class="btn btn-info navbar-btn navbar-right" role="button" href="/login">'
              +user.username+'</a>'

    }
    else
    {
      return '<a class="btn btn-primary navbar-btn navbar-right" role="button" href="/login">登录/注册</a>'
    }

  },

  isLogin(){
    let userid = Meteor.userId();
    if ( userid != undefined ) {
      return true;
    }
    return false;
  }
});


Template.App_Header.events({
  "click .navbar-form"(event, instance){
    FlowRouter.go("/search");
  }
});
